#ifndef __CONTROL_H__
#define __CONTROL_H__

#define PID_T 3

/* TPM period(ms) */
#define PIT0_PERIOD 2
#define PIT1_PERIOD 200

/* data collection time */
#define AMP_TIME 50
#define AMP_HISTORY 20

#define LIGHT_MOTOR_E 1000

typedef struct{
    int intrack;
    int instraight;
    int control_lock;
    int islost;
}track_status;

typedef struct{
    double e[PID_T];
    double e_int;
    double k[3];
    double duty_out;
    double u;
    double s;
    double n;
    double c;
    double buffer;
    int t;
}control_struct;

typedef struct{
    int port,ch,val;
}led_status;

void led_set(void);
void led_update(void);
void control_update(void);

#endif /* __CONTROL_H__ */
